<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted Access');
$user		= JFactory::getUser();
$canEdit	= $user->authorise('core.edit',			'com_zorder.product.'.$item->id);
$canCreate	= $user->authorise('core.create',		'com_zorder.product.'.$item->catid);
$canEditOwn	= $user->authorise('core.edit.own',		'com_zorder.product.'.$item->id) && $item->created_by == $user->id;

?>
<?php foreach($this->items as $i => $item): ?>
	<tr class="row<?php echo $i % 2; ?>">
		<td>
			<?php echo $item->id; ?>
		</td>
		<td>
			<?php echo JHtml::_('grid.id', $i, $item->id); ?>
		</td>
		<td>
			<?php if ($canEdit || $canEditOwn) : ?>
			
				<a href="<?php echo JRoute::_('index.php?option=com_zorder&task=product.edit&id='.$item->id);?>">
					<?php echo $this->escape($item->title); ?></a>
			<?php else : ?>
				<?php echo $this->escape($item->name); ?>
			<?php endif; ?>							
		</td>
		<td>
			<?php echo $item->price; ?>
		</td>
		<td>
			<?php echo $item->description; ?>
		</td>
		<td>
			<?php echo $item->type; ?>
		</td>		
	</tr>
<?php endforeach; ?>
